<template>
    <el-dialog :visible.sync="isShow" width="1000px">
      <div style="background-color: #fff;height: 500px;">
        <el-table :data="lesseeList" size='medium' border>
          <el-table-column width="80" label="选择ID" >
            <template slot-scope="{row, index}">
              <el-radio v-model="radio" :label="row">{{ row.id }}</el-radio>
            </template>
          </el-table-column>
          <el-table-column label="租户名称" prop="name" :show-overflow-tooltip="true"></el-table-column>
          <el-table-column label="商户联系人" prop="contacts" :show-overflow-tooltip="true"/>
          <el-table-column label="商家电话" prop="phone" :show-overflow-tooltip="true"/>
        </el-table>
        <el-col style="margin-top: 20px;">
          <el-pagination
              background
              @current-change="findLesseeList"
              :current-page.sync="page"
              :page-size='size'
              layout="prev, pager, next"
              :total="totalSize">
            </el-pagination>
        </el-col>
      </div>
      <div style="margin-top: 30px;width: 100%;display: flex;flex-direction: row;justify-content: flex-end;">
      <el-button type="primary" @click="confirm">确认</el-button>
      <el-button @click="close" type="info" size="mini">关闭</el-button>
    </div>
    </el-dialog>
</template>
    
    <script>
    import {
      findLesseeList
    } from '@/api/system/lessee.js'
    export default {
      components: {
      },
      props:{

      },
      data() {
        return {
          isShow: false,
          page: 1,
          size: 10,
          totalSize: 0,
          searchParams: {},
          lesseeList: [],
          radio: ''
        }
      },
      created(){
        this.findLesseeList()
      },
      methods:{
        show(val){
          this.isShow = true
          this.radio = val
          
        },
        close(){
            this.isShow = false
        },
        confirm(){
          if(!this.radio){
            this.$message({
              message: '请选择商户',
              type: 'error'
            })
            return
          }
          this.$emit('confirm', this.radio)
          this.isShow = false
        },
        findLesseeList(){
          this.searchParams.page = this.page
          this.searchParams.size = this.size
          this.searchParams.type = 'all'
          findLesseeList(this.searchParams).then(res => {
            if(res.data.code == 10000){
              this.totalSize = res.data.data.total_count
              this.lesseeList = res.data.data.list
            }
          });
        }
      }
    }
    </script>
    
    <style lang="scss" scoped>
  
    </style>
    